home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / pcw.zip / QPUTS.C < prev    next >
Text File  |  1990-01-16  |  3KB  |  70 lines

  1. /************************************************************/
  2. /* File Id.                  Qputs.C                        */
  3. /* Author.                   Stan Milam.                    */
  4. /* Date Written.             11/06/88.                      */
  5. /* Date Last Modified.       01/29/89.                      */
  6. /* Changed name to qputs and added function qvputs to file  */
  7. /*                                                          */
  8. /*           (c) Copyright 1989-90 by Stan Milam            */
  9. /*                                                          */
  10. /* Comments:  This routine will write a character string to */
  11. /* the video screens memory.  Calls an Assembly routine,    */
  12. /* Tputs, to do the actual screen writing.                  */
  13. /************************************************************/
  14.  
  15. #include <string.h>
  16. #include <dos.h>
  17. #include "pcw.i"
  18. #include "pcwproto.h"
  19.  
  20. int qputs(int row, int col, int fcolor, int bcolor, char *s) {
  21.  
  22.    int far *scrnptr;
  23.    int page, pagesize, attr;
  24.    int mx_rows, mx_cols;
  25.    unsigned offset, scrnseg;
  26.  
  27.    if (!chk_video_state(&mx_rows,&mx_cols)) return(0);
  28.  
  29.    if (col == CENTER)
  30.       col = ((mx_cols / 2) - (strlen(s) / 2));
  31.  
  32.    scrnseg = getscrnseg();
  33.    page    = getpage();
  34.    pagesize= getpagesize();
  35.  
  36.    attr    = MK_ATTR(fcolor,bcolor);
  37.    offset  = MK_SCRNOFF(row,col);
  38.    scrnptr = (int far *) MK_FP(scrnseg,offset);
  39.    Tputs(scrnptr, (char far *) s, attr); return(1);
  40. }
  41.  
  42. /************************************************************/
  43. /*                            Qvputs                        */
  44. /*                                                          */
  45. /* This functions is basically the same as qputs except that*/
  46. /* it writes to the screen vertically.  Calls assembler     */
  47. /* routine Tvputs.                                          */
  48. /*                                                          */
  49. /************************************************************/
  50.  
  51. int qvputs(int row, int col, int fcolor, int bcolor, char *s) {
  52.  
  53.    int far *scrnptr;
  54.    int attr, page, pagesize;
  55.    int mx_rows, mx_cols;
  56.    unsigned offset, scrnseg;
  57.  
  58.    if (!chk_video_state(&mx_rows,&mx_cols)) return(0);
  59.    if (col == CENTER) col = (int) mx_cols / 2;
  60.  
  61.    scrnseg = getscrnseg();
  62.    page    = getpage();
  63.    pagesize= getpagesize();
  64.    attr    = MK_ATTR(fcolor,bcolor);
  65.    offset  = MK_SCRNOFF(row,col);
  66.    scrnptr = (int far *) MK_FP(scrnseg,offset);
  67.    Tvputs(scrnptr, (char far *) s, attr);
  68.    return(1);
  69. }
  70.